import React from "react";

class Hello extends React.Component {
  state = {
    count: 1,
  };

  /**
   * 挂载完成
   *
   * PS:
   *    1. 获取到真实DOM
   *    2. 做定时器
   *    3. 调用接口获取数据
   *    4. 监听全局的一些事件
   *    5. 订阅外部消息
   */
  componentDidMount() {
    // console.log(document.querySelector("h2")?.innerHTML);
  }

  render() {
    return (
      <div>
        <h2>Hello</h2>
        <button>count: {this.state.count}</button>
      </div>
    );
  }
}

class App extends React.Component {
  render() {
    return (
      <div>
        <h1>App</h1>
        <Hello />
        <Hello />
      </div>
    );
  }
}

export default App;
